<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <title><h:outputText value="#{msgs.ged}"/></title>
        <link type="text/css" rel="stylesheet" href="css/style.css" media="all"/>
    </h:head>
    
    <h:body>
        <div class="container">
            <div class="conteudo">
                <div class="cabecalho">
                    <h:outputText value="#{msgs.ged}"/>
                </div><!-- Fim do cabecalho -->

                <h:form styleClass="principal">
                    <h:messages layout="table" showSummary="true" showDetail="false" globalOnly="true"
                                styleClass="msgErro" infoClass="msgInfo" style="text-align: center; width: 100%;"/>
                    
                    <h:commandButton value="#{msgs.inserir}" action="inserir"/>
                    <br/>

                    <h:outputText value="#{msgs.vazio}" rendered="#{empty ctrDocumento.documentos}"/>
                    
                    <rich:dataTable id="dtDocumentos" value="#{ctrDocumento.documentos}" var="docs" rows="15"
                                    rendered="#{not empty ctrDocumento.documentos}" styleClass="dataTable">

                        <rich:column width="250px" sortBy="#{docs.nome}">
                            <f:facet name="header">
                                <h:outputText value="Nome"/>
                            </f:facet>
                            <h:outputText value="#{docs.nome}"/>
                        </rich:column>

                        <rich:column width="250px" sortBy="#{docs.usuario.nome}">
                            <f:facet name="header">
                                <h:outputText value="Responsável"/>
                            </f:facet>
                            <h:outputText value="#{docs.usuario.nome}"/>
                        </rich:column>
                        
                        <rich:column width="50px">
                            <f:facet name="header">
                                <h:outputText value=""/>
                            </f:facet>
                            <h:commandLink action="#{ctrDocumento.excluir}">
                                <f:setPropertyActionListener value="#{docs}" target="#{ctrDocumento.documento}"/>
                                <h:graphicImage value="img/delete.png" title="#{msgs.excluir}"/>
                            </h:commandLink>

                            <h:commandLink action="alterar">
                                <f:setPropertyActionListener value="#{docs}" target="#{ctrDocumento.documento}"/>
                                <h:graphicImage value="img/edit.png" title="#{msgs.alterar}" style="margin-left: 6px;"/>
                            </h:commandLink>
                        </rich:column>
                    </rich:dataTable>
                </h:form>
            </div><!-- Fim do conteudo -->
        </div><!-- Fim do container -->
        
        <div class="rodape">
            <div class="info">Desenvolvido por Jefferson Cardoso</div>
        </div>
    </h:body>
</html>

